package data.composition.factory;

import cn.hutool.core.bean.BeanUtil;
import lombok.Data;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * @author ZhangJinyu
 * @since 2024-12-13
 */
@Data
public class School {
    private Long id;
    private String name;

    public static List<School> demo1() {
        List<School> schools = new LinkedList<>();
        School qinghua = new School();
        qinghua.setId(1L);
        qinghua.setName("清华");
        schools.add(qinghua);
        School beida = new School();
        beida.setId(2L);
        beida.setName("北大");
        schools.add(beida);
        return schools;
    }

    public static List<Map<String, Object>> demo2() {
        return demo1().stream().map(BeanUtil::beanToMap).toList();
    }
}
